<template>
    <div class="header_container">
			<el-breadcrumb separator="/">
				<el-breadcrumb-item :to="{ path: '/userList' }">首页</el-breadcrumb-item>
				<el-breadcrumb-item v-for="(item, index) in $route.meta" :key="index">{{ item }}</el-breadcrumb-item>
			</el-breadcrumb>
			<el-dropdown @command="handleCommand" menu-align='start'>
				<img src="../../static/signout.png" class="avator">
				<el-dropdown-menu slot="dropdown">
					<el-dropdown-item command="signout">退出</el-dropdown-item>
				</el-dropdown-menu>
			</el-dropdown>
    </div>
</template>

<script>
	// import { baseImgPath } from '@/config/env'
	import { mapActions, mapState } from 'vuex'
	import { delCookie } from '@/utils/storage'

    export default {
    	data(){
    		return {
    			// baseImgPath,
    		}
    	},
    	created(){
    		if (!this.adminInfo.id) {
    			this.getAdminData()
    		}
    	},
    	computed: {
    		...mapState(['adminInfo']),
    	},
		methods: {
			...mapActions(['getAdminData']),
			handleCommand(command) {
				if(command == 'signout') {
					delCookie('token')
					this.$message({
							type: 'success',
							message: '退出成功'
					});
					this.$router.push('/')
				}
			},
		}
    }
</script>

<style lang="less">
	@import '../style/mixin';
	.header_container{
		background-color: #EFF2F7;
		height: 60px;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding-left: 20px;
	}
	.avator{
		.wh(25px, 25px);
		margin-right: 37px;
	}
	.el-dropdown-menu__item{
        text-align: center;
    }
</style>
